<?php
//set error reporting
error_reporting(E_ERROR | E_WARNING);

class ValidationFunctions{
	
	public static function loginUser($email, $password, $db){
		
		//test for correctness
		$res = $db->loginUser($email,$password);
		
		return $res;
	}
	
	public static function validateName($name){
		
		//since there are so many special names, we just make sure that the name is of lenght 1 or greater
		if(strlen($name) >= 1){
			return true;
		}
		else{
			return false;
		}
	}
	
	public static function validatePhone($phoneNumber){
		
		if(is_numeric($phoneNumber)){
			return true;
		}
		else{
			return false;
		}
	}
	
	public static function validateEmail($email){
		
		//use regular expressions to make sure the email is valid
		if(filter_var( $email, FILTER_VALIDATE_EMAIL) != false){
			return true;
		}
		//otherwise return 0
		else{
			return false;
		}
	}
	
	public static function validatePasswords($pw1, $pw2){
		
		//make sure they are longer than 0
		if(strlen($pw1) == 0 || strlen($pw2) ==0){
			return false;
		}
		
		//now make sure they are equal
		if($pw1 == $pw2){
			return true;
		}
		else{
			return false;
		}
	}
}